/*
 * @Description:
 * @Author: Chetwyn
 * @Date: 2019-05-20 14:28:38
 * @LastEditors: Chetwyn
 * @LastEditTime: 2019-08-12 16:01:37
 */
import React, { PureComponent } from 'react';
import { Image, View, StyleSheet } from 'react-native';
import { connect } from 'react-redux';
import LottieView from 'lottie-react-native';

// import { getColors } from '../theme';
// import { ic_loading } from '../assets';;

class Loading extends PureComponent {
  render() {
    return this.props.loadingCount > 0 ? (
      <View style={styles.container} pointerEvents={'box-only'}>
        <LottieView
          style={{ width: 100, height: 100 }}
          source={require('../assets/animations/loading.json')}
          autoPlay
          loop
        />
      </View>
    ) : null;
  }
}

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    alignItems: 'center',
    justifyContent: 'center',
  },
  loadingContainer: {
    height: 90,
    width: 90,
    borderRadius: 4,
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

const mapStateToProps = state => ({
  loadingCount: state.common.loadingCount,
  successTip: state.common.successTip,
});

export default connect(
  mapStateToProps,
  null
)(Loading);
